<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
* {
      box-sizing: border-box;
    }

    .box {
      width: 560px;
      height: 400px;
      background-color: pink;
    }

    img {
      width: 100%;
      height: 320px;
      display: block;
    }

    .bottom {
      height: 80px;
      background-color: green;
      padding: 10px 10px 0 10px;
    }

    .bottom p {
      margin: 0;
      color: white;
      margin-bottom: 10px;
    }

    .bottom-ul {
      width: 150px;
      display: flex;
      list-style: none;
      margin: 0;
      padding: 0;
      justify-content: space-between;
      align-items: center;
    }

    .bottom-ul li {
      width: 8px;
      height: 8px;
      margin: 4px;
      border-radius: 50%;
      background: #fff;
      opacity: 0.4;
      cursor: pointer;
    }

    li.light {
      width: 12px;
      height: 12px;
      opacity: 1;
    }
    .left{
      margin-left: 400px;

    }
</style>

<body>
    <div class="box">
    <img src="../作业/image/course01.png" alt="">
    <div class="bottom">
      <p></p>
      <ul class="bottom-ul">
        <li class="light"></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
      </ul>
      <button class="left"><</button>
      <button class="right">></button>
    </div>
  </div>

    <script>
    let sliderData=[ 
      { url: '../作业/image/course01.png', title: '对人类来说会不会太超前了？', color: 'rgb(100, 67, 68)' },
      { url: '../作业/image/course02.png', title: '开启剑与雪的黑暗传说！', color: 'rgb(43, 35, 26)' },
      { url: '../作业/image/course03.png', title: '真正的jo厨出现了！', color: 'rgb(36, 31, 33)' },
      { url: '../作业/image/course04.png', title: '快来分享你的寒假日常吧~', color: 'rgb(139, 98, 66)' },
      { url: '../作业/image/course05.png', title: '李玉刚：让世界通过B站看到东方大国文化', color: 'rgb(67, 90, 92)' },
      { url: '../作业/image/course06.png', title: '哔哩哔哩小年YEAH', color: 'rgb(166, 131, 143)' },
      { url: '../作业/image/course07.png', title: '一站式解决你的电脑配置问题！！！', color: 'rgb(53, 29, 25)' },
      { url: '../作业/image/course08.png', title: '谁不想和小猫咪贴贴呢！', color: 'rgb(99, 72, 114)' },
    ]
    const str1=document.querySelector('img')

    const str2=document.querySelector('p')

    const str3 =document.querySelector('.bottom')

    let i =0

    let time = setInterval(function(){
        i++
        if(i>=sliderData.length){
            i =0
        }
        str1.src=sliderData[i].url
        str2.innerHTML=sliderData[i].title
        str3.style.backgroundColor=sliderData[i].color

        const src =document.querySelector('ul .light')
        src.classList.remove('light')

       const li = document.querySelector(`li:nth-child(${i + 1})`)
       li.classList.add('light')
  
    },500)
    </script>
</body>
</html>